<div class="upload-image-items">
  <div class="upload-image-item"
    ng-class="{error: file.error}"
    data-id="{{file.id}}"
    ng-repeat="file in ngModel track by $index">

    <div class="image"
      ng-if="file.url && (isImg(file) || isSnapshot(file))"
      style="background-image:url({{file.url}})"
    ></div>
    <div class="image"
      ng-if="(file.url || file.cover_url) && isVideo(file)"
      style="background-image:url({{file.cover_url || getSnapshot(file)}})"
    >
    </div>
    <div class="image"
      ng-if="!file.url && file.id && isImg(file)"
      style="background-image:url({{$ctrl.uploadConfig.viewUrl + '?file_id=' + file.id}})"
    ></div>

    <div class="image"
      ng-if="!isImg(file) && !isVideo(file) && !isSnapshot(file)">
      <ma-icon ma-type="{{getFileIcon(file)}}"></ma-icon>
    </div>

    <div class="handle-box"
      ng-show="file.progress === undefined || file.progress === 100">
      <div>
        <ma-icon class="close"
        ma-type="{{isVideo(file) ? 'playcircleo' : 'eyeo'}}"
        ma-click="viewFile(ngModel, file, $index)"></ma-icon>
        <ma-icon class="close"
          ma-type="delete"
          ma-click="delFile(file, $index)"
          ng-show="showDelete != 'false' && file.showDelete !== false && (file.progress === undefined || file.progress === 100)"></ma-icon>
      </div>
    </div>

    <ma-progress ma-type="circle"
      ma-status="danger"
      ma-size="70"
      ma-stroke-width="5"
      ma-percent="{{file.progress}}"
      ng-show="file.progress !== undefined && file.progress !== 100"></ma-progress>

    <div class="extra" ng-if="extra">
      <div ng-compile="extra" ng-params="{$index: $index}"></div>
    </div>
  </div>


  <div class="upload-image-item add"
    ng-hide="$ctrl.uploadConfig.limit <= ngModel.length">
    <div class="upload-img-item-add-box">
      <div class="upload-img-item-add-box-container">
        <ma-icon ma-type="plus"></ma-icon>
        <div ng-bind-html="$ctrl.uploadConfig.uploadText || '上传照片'"></div>
      </div>
    </div>
  </div>

  <div class="upload-image-item add-double"
    ng-repeat="item in $ctrl.uploadConfig.limitArray track by $index"
    ma-click="clickInput($event)"
    ng-if="$index < ($ctrl.uploadConfig.limit - ngModel.length) && $index !== 0">
    <div class="upload-img-item-add-box">
        <div class="upload-img-item-add-box-container">
          <ma-icon ma-type="plus"></ma-icon>
          <div ng-bind-html="$ctrl.uploadConfig.uploadText || '上传照片'"></div>
        </div>
    </div>
  </div>
</div>
